使用 apt 安裝
❯ sudo apt update
❯ sudo apt install coturn
❯ turnserver -a -o -v -n --no-dtls --no-tls \
-u username:password -r testRealm & sleep infinity
自己編譯原始碼
❯ sudo apt update
❯ sudo apt install build-essential
❯ git clone https:// github.com/coturn/coturn.git
❯ cd coturn
# 可能會有缺一些套件 缺什麼就裝什麼
❯ ./configure --prefix =/usr/local/coturn
❯ sudo make -j 4 && sudo make install
使用 Docker
Dockerfile
FROM ubuntu:20.04
# Setup turn server
RUN apt-get update -y
RUN apt-get install coturn -y
EXPOSE 3478/tcp
EXPOSE 3478/udp
CMD turnserver -a -o -v -n --no-dtls --no-tls -u username:password -r testRealm & sleep infinity
啟動 docker
❯ docker build --tag coturn .
❯ docker run -p 3478:3478 -p 3478:3478/udp coturn
測試網址: https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/
網頁中可以看到一句話
If you test a STUN server, it works if you can gather a candidate with type "srflx". If you test a TURN server, it works if you can gather a candidate with type "relay".